#include "brighness_config.h"

u8 brighness_level;
static u8 flag;
u16 light_length;

void set_light_length(u16 length)
{
    if ((length>0)&(length<101))
    {
        light_length=length;
        LOG_INFO("light_length %d\n",light_length);
    }
}

u16 get_light_length()
{
    return light_length;
}

u16 get_color_length()
{
    return (get_light_length()*4+8);
}

u16 get_buffer_length()
{
    return (get_color_length()*4+1);
}

void init_brighness_level(u8 level)
{
    if (level <0)
    {
        brighness_level =0;
    }
    else if(brighness_level>63)
    {
        brighness_level=63;
    }
    else
    {   
        brighness_level=level;
    }
    LOG_INFO("brighness_level is%d\n",brighness_level);
}

void set_brighness_level(u8 level)
{
    if (level <0)
    {
        brighness_level =0;
    }
    else if(brighness_level>63)
    {
        brighness_level=63;
    }
    else
    {   
        brighness_level=level;
    }
    LOG_INFO("brighness_level is%d\n",brighness_level);
}

u8 get_brighness_level()
{
    return brighness_level;
}